package com.vict.bean.pay.vo;

import com.alibaba.fastjson.annotation.JSONField;
import com.vict.framework.fastjsonserializer.DecimalDeserializer;
import com.vict.framework.fastjsonserializer.DecimalSerializer;
import com.vict.framework.fastjsonserializer.TimestampDeserializer;
import com.vict.framework.fastjsonserializer.TimestampSerializer;
import com.vict.framework.pay.entity.PayBack;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.math.BigDecimal;
import java.sql.Timestamp;
import java.util.Optional;

@Data
public class PayBackVO {

    @JSONField(serialize = false, deserialize = false)
    private PayBack payBack;


    @ApiModelProperty(value="payBackDtoId")
    public String getPayBackDtoId() {
        return Optional.ofNullable(payBack).map(o-> o.getPayBackDtoId()).orElse(null);
    }

    @ApiModelProperty(value="payDtoId")
    public String getPayDtoId() {
        return Optional.ofNullable(payBack).map(o-> o.getPayDtoId()).orElse(null);
    }

    @ApiModelProperty(value="创建时间")
    @JSONField(serializeUsing = TimestampSerializer.class, deserializeUsing = TimestampDeserializer.class)
    public Timestamp getStartTime() {
        return Optional.ofNullable(payBack).map(o-> o.getStartTime()).orElse(null);
    }

    @ApiModelProperty(value="退款金额")
    @JSONField(serializeUsing = DecimalSerializer.class, deserializeUsing = DecimalDeserializer.class)
    public BigDecimal getBackMoney() {
        return Optional.ofNullable(payBack).map(o-> o.getBackMoney()).orElse(null);
    }

    @ApiModelProperty(value="退款成功时间")
    @JSONField(serializeUsing = TimestampSerializer.class, deserializeUsing = TimestampDeserializer.class)
    public Timestamp getBackTime() {
        return Optional.ofNullable(payBack).map(o-> o.getBackTime()).orElse(null);
    }
}
